Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正RoundRobin负载均衡方式的bug #14

Closed
wants to merge 6 commits into from

Conversation

zhouym06
Copy link

修正weightSequence过快增长导致的高权重机器调用过多问题。
currentWeight本应为每轮加一,但原错写为每次调用加一。

设有两台机器权重分别为1和2,设计应为第一轮分别执行一次,第二轮在第二台执行一次。
但原算法为第一轮各有1/2的机会执行一次,第二轮在第二台执行一次。
造成高权重机器被调用次数过多。

修正为每次检查sequence完成一轮后才增加currentWeight。

@zhouym06
Copy link
Author

猜测作者可能是想让weightInvokers作为队列不断存储要调用的invoker,
但每次调用都清零 List weightInvokers = new ArrayList();
让未被调用的低权重机器失去了大量机会。

@zhouym06
Copy link
Author

orz,终于好了,之前手滑挪了文件夹位置……

@teaey
Copy link
Contributor

teaey commented Mar 18, 2016

@teaey teaey closed this Mar 18, 2016
AlbumenJ added a commit that referenced this pull request Aug 26, 2024
AlbumenJ added a commit that referenced this pull request Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants